package com.qh.resourcehub.utils;

import java.util.HashMap;
import java.util.Map;

public class ResultUtils {
    //默认成功返回集
    public static Map<String, Object> loginSuccess() {
        Map<String, Object> retMap = new HashMap<String, Object>();
        retMap.put("retcode", 1);
        retMap.put("retmsg", "登录成功！");
        return retMap;
    }

    //默认成功返回集
    public static Map<String, Object> loginErr() {
        Map<String, Object> retMap = new HashMap<String, Object>();
        retMap.put("retcode", -1);
        retMap.put("retmsg", "登录失败！");
        return retMap;
    }

    //默认成功返回集
    public static Map<String, Object> loginNotFound() {
        Map<String, Object> retMap = new HashMap<String, Object>();
        retMap.put("retcode", -1);
        retMap.put("retmsg", "用户不存在！");
        return retMap;
    }

    //默认成功返回集
    public static Map<String, Object> success() {
        Map<String, Object> retMap = new HashMap<String, Object>();
        retMap.put("retcode", 1);
        retMap.put("retmsg", "操作成功！");
        return retMap;
    }

    //默认成功但无数据返回集
    public static Map<String, Object> successNoData() {
        Map<String, Object> retMap = new HashMap<String, Object>();
        retMap.put("retcode", 0);
        retMap.put("retmsg", "操作成功,但无数据！");
        return retMap;
    }

    //默认失败的返回集
    public static Map<String, Object> error() {
        Map<String, Object> retMap = new HashMap<String, Object>();
        retMap.put("retcode", -1);
        retMap.put("retmsg", "操作失败或无数据！");
        return retMap;
    }

    //默认参数异常的返回集
    public static Map<String, Object> paramsError() {
        Map<String, Object> retMap = new HashMap<String, Object>();
        retMap.put("retcode", -1);
        retMap.put("retmsg", "参数异常！");
        return retMap;
    }

    //未登录的返回集
    public static Map<String, Object> notLoginError() {
        Map<String, Object> retMap = new HashMap<String, Object>();
        retMap.put("retcode", -1);
        retMap.put("retmsg", "用户未登录！");
        return retMap;
    }

    //自定义返回集
    public static Map<String, Object> setResult(Integer retCode, String retMsg, String retData) {
        Map<String, Object> retMap = new HashMap<String, Object>();
        retMap.put("retcode", retCode);
        retMap.put("retmsg", retMsg);
        retMap.put("retdata", retData);
        return retMap;
    }

    //自定义返回集
    public static Map<String, Object> setResult(Integer retCode, String retMsg) {
        Map<String, Object> retMap = new HashMap<String, Object>();
        retMap.put("retcode", retCode);
        retMap.put("retmsg", retMsg);
        return retMap;
    }
}
